const Parameter = require('Parameter')

module.exports = app => {
  //json字符串的验证
  app.validator.addRule('jsonString', (rule, value) => {
    try {
      JSON.parse(value);
    } catch (err) {
      return 'must be json string';
    }
  })
  app.validator = new Parameter(app.config.validate)
}